package com.sun.alen.stagetwo;

import com.sun.alen.stagetwo.testClass.Dog;
import com.sun.alen.stagetwo.testClass.Owenr;

/**
 * DogAndOwner类演示了Dog和Owner类的基本用法
 * 创建多个Dog和Owner对象，并调用它们的方法
 */
public class DogAndOwner {
    /**
     * 程序入口点，用于演示Dog和Owner对象的创建和方法调用
     * 创建3个Dog对象和3个Owner对象，并调用相关方法
     * @param args 命令行参数数组
     */
    public static void main(String[] args) {

        // 创建三个Dog对象并调用bark或eat方法
        Dog dog1 = new Dog("旺财", 5);
        System.out.print(dog1.getAge()+"岁的"+dog1.getName()+"正在");
        dog1.bark();

        Dog dog2 = new Dog("小黄", 3);
        System.out.print(dog2.getAge()+"岁的"+dog2.getName()+"正在");
        dog2.bark();

        Dog dog3 = new Dog("小黑", 1);
        System.out.print(dog3.getAge()+"岁的"+dog3.getName()+"正在");
        dog3.eat();

        // 创建三个Owner对象并调用feedDog方法
        Owenr owenr1 =new Owenr("阿熙",22,dog1);
        Owenr owenr2 =new Owenr("小王",18,dog2);
        Owenr owenr3 =new Owenr("小李",16,dog3);
        System.out.println(owenr1.getName()+"养了一只"+owenr1.getDog().getAge()+"岁的"+owenr1.getDog().getName());
        System.out.println(owenr2.getName()+"养了一只"+owenr2.getDog().getAge()+"岁的"+owenr2.getDog().getName());
        System.out.println(owenr3.getName()+"养了一只"+owenr3.getDog().getAge()+"岁的"+owenr3.getDog().getName());
        owenr1.feedDog();
        owenr2.feedDog();
        owenr3.feedDog();
    }
}